package com.neusoft.acquistion.sensor.consumer.controller;

import com.neusoft.acquistion.sensor.consumer.entity.Admin;
import com.neusoft.acquistion.sensor.consumer.service.IAdminService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;

import java.util.List;

/**
 * <p>
 * 管理员信息表 前端控制器
 * </p>
 *
 * @author 段静迪
 * @since 2024-04-24
 */
@Controller
@Tag(name = "测试Swagger3", description = "测试Swagger3注解")
@RequestMapping("/admin")
//http://127.0.0.1:8010/swagger-ui/index.html
public class AdminController {
    @Autowired
    IAdminService adminService;

    @Operation(summary = "测试Swagger3注解方法Get")
    @Parameters(
            {@Parameter(name = "id",description = "编码"),@Parameter(name = "headerValue",description = "header传送内容")})
    @ApiResponses({
            @ApiResponse(responseCode = "200", description = "请求成功"),
            @ApiResponse(responseCode = "400", description = "请求参数没填好"),
            @ApiResponse(responseCode = "401", description = "没有权限"),
            @ApiResponse(responseCode = "403", description = "禁止访问"),
            @ApiResponse(responseCode = "404", description = "请求路径没有或页面跳转路径不对")
    })
    @GetMapping("/query/find/all")
    public List<Admin> findAll() {
        return adminService.findAll();
    }
}
